package day4;

public class Test01 {
    public static void main(String[] args) {
        //小类型转大类型
        long  num = 10;
        System.out.println("num"+num);
        //double类型
        double price = 8.0F;
        System.out.println("price"+price);

        //大转小,编译失败
        // float pi = 3.14;

        byte b = 10;
        short s= 5;
        int num3 = b+s;
        System.out.println("num3:"+num3);

        //强转
        float f1 = (float)3.14;
        float f2 = 3.14F;
        System.out.println("f1:"+f1);
        System.out.println("f2:"+f2);

        int i = (int)3.14;
        System.out.println("i:"+i);
        int i2 = (int)3.54;//精度会丢失
        System.out.println("i2:"+i2);

        //表达式
        byte b1 = 10;
        short s1 = 5;
        double d2 = 2.3;
        double result=(b1-5)*s1+d2;
        System.out.println("result:"+result);
        float result2 = (float)((b1-5)*s1+d2);
        System.out.println("result2:"+result2);

        //特殊情况
        byte byte1 = 10;
        System.out.println("byte1:"+byte1);
        short short1 = 20;
        System.out.println("short1:"+short1);
        char char1 = 97;
        System.out.println("char1:"+char1);
    }
}
